package com.ebs.md.fxmonitor.marketmonitor.config;

/**
 * Revision Author:
 *  $File: //depot/MarketData/fxmonitor/main/src/main/java/com/ebs/md/fxmonitor/marketmonitor/config/SpoofingBySizeConfigImpl.java $
 *  $Revision: #13 $
 *  $DateTime: 2012/08/22 14:01:25 $
 *  $Change: 113511 $
 *  $Author: Arik.Sher $
 */

import org.apache.log4j.Logger;

import com.ebs.md.fxmonitor.marketmonitor.MarketMonitorConsts;
import com.ebsdr.fsp.ccc.configuration.IConfiguration;

public class SpoofingBySizeConfigImpl implements IConfigListener, ISpoofingBySizeConfig, MarketMonitorConsts
{
    final protected Logger logger = Logger.getLogger(getClass());
    final protected static String xsdPath = "/MonitoredMarketActivity/SpoofingsBySize/SpoofingBySize";

    private long lifeTimeThreshold;
	private int  priceLevelThreshold;
	private long orderSizeThreshold;
	private int  orderFillSizeThreshold;

	
	@Override
	public String getName() {
		return BASIC_CONFIG_NAME;
	}

	@Override
	public void onConfig(IConfiguration configuration) 
	{
		lifeTimeThreshold      = configuration.getLong(xsdPath + "/@interruptTime", EVENT_SPOOFING_LIFE_TIME_THRESHOLD);
		priceLevelThreshold    = configuration.getInt (xsdPath + "/@priceLevel",    EVENT_SPOOFING_PRICE_LEVEL_THRESHOLD);
		orderSizeThreshold     = configuration.getLong(xsdPath + "/@orderSize",     EVENT_SPOOFING_ORDER_SIZE_THRESHOLD);
		orderFillSizeThreshold = configuration.getInt (xsdPath + "/@orderFillSize", EVENT_SPOOFING_ORDER_FILL_SIZE_THRESHOLD);

		logger.info( getConfigInfo() );
	}
	
	@Override
	public String getConfigInfo() {
		StringBuilder sb = new StringBuilder("SpoofingBySizeConfigImpl: ");
		
		sb.append( " lifeTime: "      + lifeTimeThreshold);
		sb.append(", priceLevel: "    + priceLevelThreshold);
		sb.append(", orderSize: "     + orderSizeThreshold);
		sb.append(", orderFillSize: " + orderFillSizeThreshold);

		return sb.toString();
	}
	
	
	@Override
	public long getLifeTimeThreshold() {
		return lifeTimeThreshold;
	}

	@Override
	public int getPriceLevelThreshold() {
		return priceLevelThreshold;
	}

	@Override
	public long getOrderSizeThreshold() {
		return orderSizeThreshold;
	}

	@Override
	public int getOrderFillSizeThreshold() {
		return orderFillSizeThreshold;
	}

}
